﻿using System.Collections.Generic;
using System.Collections.Specialized;

using ExtensibleEventViewer.Core.Interfaces;


namespace ExtensibleEventViewer.Core.Primitives
{
	public sealed class EventLogConnector
	{
		public EventLogConnector(string computerName, IEventLogProvider provider)
		{
			ComputerName = computerName;
			Provider = provider;
		}

		public string ComputerName
		{
			get; 
			private set;
		}

		public string ProviderID
		{
			get
			{
				return Provider.ProviderID;
			}
		}

		private IEventLogProvider Provider
		{
			get; 
			set;
		}

		public EventLogEntity GetEventLog(string name)
		{
			return Provider.GetEventLog(name, ComputerName);
		}

		public IEnumerable<EventLogEntity> GetEventLogList()
		{
			return Provider.GetEventLogList(ComputerName);
		}

		public IEnumerable<EventLogRecord> Select(NameValueCollection selectionCriteria)
		{
			return Provider.Select(selectionCriteria, ComputerName);
		}
	}
}
